ROM Map
Contents: 08000000 ROM and General Use code 08020000 ? NPC Mechanics? (NPC scripts, height/maps, etc.) 08038000 Dialogue/Menus 080AD000 Party Mechanics 080C8000 Map Mechanics - Event Mechanics 080F8000 Menus 08108000 Shop Mechanics 08118000 Battle Mechanics 08138000 Ability Mechanics 081AC000 Title Mechanics* 081AC000 Lucky Dice (238:9/19)* 081B2000 Lucky Wheels (238:10/20) 081B8000 Super Lucky Dice (238:8/18) 081C0000 Audio 081C4530 = Songs *Addressing needs fixing. 08300000 = Sprite Data BYTE - Sprite width BYTE - Sprite height SHORT - Image scale. A value of 0x0100 is 100%, 0x0200 is 200%, and 0x0080 is 50% (In hex 0x080 is half of 0x100). BYTE - Number of directions the sprites have (Party members have 5, NPCs have 3, battle sprites have 2, e.t.c. Sometimes this value is different to represent that some of the directions are mirrored compared to how they usually are) BYTE - Number of animations BYTE - X offset BYTE - Y offset BYTE - Unknown BYTE - Collision Radius BYTE - Compression format BYTE - Unused (Version 0.4+ of the editor uses this space to store the number of sprites) WORD - Pointer to a collection of pointers to the graphical sprite data WORD - Pointer to a collection of pointers to the animation data 08680000 = Master File Table HEX;DEC; 000;000;08000000 = ROM 001;001;08680000 = Master File Table 002;002;08682000 = Build Date? 003;003;08020000 = 004;004;08038000 = 005;005;080AD000 = Party Mechanics 006;006;080C8000 = 007;007;080F8000 = 008;008;08108000 = 009;009;08118000 = Battle Mechanics 00A;010;081A0000 = 00B;011;081A6000 = 00C;012;08138000 = Ability Types/Animations 00D;013;081AC000 = 00E;014;081B2000 = 00F;015;081B8000 = 010;016;081C0000 = Audio Mechanics 011;017;081C0000 = Audio Mechanics 012;018;08300000 = Master Sprite Data 013;019;08682010 = Font 014;020;08684010 = 015;021; = See Image Viewer(16)? 016;022; = Title Screen (Picture of lighthouse) ;032; = Nintendo screen. ;034; = Golden Sun screen. ;035; = Small World Map Image ;036; = Large World Map Image ;039-128?; = Battle Background ;132-133 = Mini-Game Backgrounds ;~410-445 = World Map stuff? (Tilesets, palette, map data…) 1D6;470;0895BB58 = Character Portraits 1D7;471;0896428C = Menu Icons ;620-1608 = Map data, Palettes, and tilesets. ;1609-1722 = Map Code ;1723-2047 = Empty Slots (Bootleg stuff???) Stuff some ROMs may have that others may not: 08F79650 = MEGAROMS Screen 1 08F8C254 = MEGAROMS Screen 2 08F9EE50 = MEGAROMS ARM code (Press L+R on boot) 08F9EFE8 = Free Note: The value at 08000468 will be 08F9EE50 instead of the original 0801319D.� General Use: 08000000 080000C0 = sleep(frames) 080000C8 = 02003610 (Reset/clear) 080000D0 = 02003610 (add if not in list ; args(pointer, priority) & sort ; Return index) 080000D8 = 02003610 (remove in list ; args(pointer) ; Return index) 080000E0 = 02003610 (priority Or x0100 (all if arg is 0) ; args(pointer) ; Return index of last match) Unknown purpose. 080000E8 = 02003610 (priority And xFEFF (all if arg is 0) ; args(pointer) ; Return index of last match) Unknown purpose. 080000F0 = 02003610 (Execute all processes where (priority And xFF00) is arg ; arg(priority_req) 080000F8 = RNG ; Random Number Generator ; Return 16-bit random number 08000100 = 08000108 = 08000110 = 08000118 = 08000120 = 08000128 = 08000428 = main() ; Boot (Pointer to 0801319C; or 08F9EE50 if MEGAROMS credit.) 080006B8 = Placed at 03000100 until 080016B8. 0200088C = 020008CC = 0200090C = 02000980 = 08000A60 /08000AC0/08000ACC/08000AE0/08000AEC/08000AFC = 08001658 = Decompress(in,out) ; Best for Distance Length? 00 = Copy eight bytes *More research needed on below* If MSB are on, Distance-Length for each bit. (F0 FF) ; If 00 00, end. ; If Length is 0, gets next byte, adds x10… Length are bits after a bit of “0”, I think. Return decompressed size (080016B8+ is not transferred to IRAM.) 080018B4 = 08001FFC = decompress(from,to) - Distance-Length - Data is in 16-bits. 08002054 = Division(numerator,denominator) (Signed?) 0800205C = Division(numerator,denominator) (Unsigned?) 08002064 = Division(numerator,denominator) (Signed. return remainder?) 0800206C = Division(numerator,denominator) (Unsigned, return remainder?) 08002096 = sin(angle) 080020A8 = Table 080028A8 = Table 080128A8 = Decompress(in,out) Format 0 (And Format 1 is at 08012AF0.) ; (Note: Found used in decompressing tilemap data.) 08012B70 = Decompress(in,out) Format 2 ^Above decompress functions put in RAM, then called. 08013060 = 080130CC = Convert Map Code BL calling from absolute to relative. Args(address, 16-bits) Thumb: 0801314C = Set free space to address & 0 out a link. (Used for adding free space when last bank is done.)(Both for 02 and 03 RAM.) 08013164 = Set free space to address. (Used for adding free space when last bank is done.)(Both for 02 and 03 RAM.) 0801319C = Boot / initialize 0801319E = DM0CNT_H 080131C0 = WAITCNT=4014 080131CA = 00-fill 03000000-03007800 Call 08014C6C (reset_space()) Call 080133C4 (Arm block to 03000100.) 020038E0:0 03001110:0 03001238:0 Debug mode off. 0300123C:0 Call 080132D0 (03007804:Build date) Call 08014BAC (Load font file, panel border palette, sprite palette, etc.) Call 08014B70 (Map Base BG0 fill all F000 (06002000-06002500)) 08013204 = DISPCNT=0140 (BG0, OBJ Char Mapping) …etc. 0801314C = removeRamEntry(offset) (03000000 table) 08013164 = setFreeSpace(address) (03000000 table) 08013288 = Load Nintendo screen. 080132A4 = 080132B8 = Return nothing (5 functions), 6th one returns 0. 080132D0 = 03007804:Build date 080132FC = Return nothing. 08013300 = get_mft_file(file_num) //Returns address of file. 0801330C = Convert Map Code BL calling from absolute to relative. Args(address, 16-bits) 0801336C = Decompress Map Code 080133C0 = 080133C4 = Arm block to 03000100. 08013560 = Frame loop / Game running (?) 080138A8 = 03001170:13 (It is this number when not pressing buttons.) 080138B4 = Controls…(Keypad?) 0801399C = Controls (RAM setup?) Also has a call that executes functions in 02003610 table (exclude 04 in byte 5.) Priority 0x0C80 might be used for refreshing/updating the map each frame. (Copy RAM to VRAM mapbase.) 08013A22 = Call to transfer RAM to PALETTE 08013B30 = Return 0 08013B38 = Return nothing. 08013B3C = Return nothing. 08013B40 = 08013B68 = 08013D84 = Transfer of Palette from RAM to PALETTE. (Useful for applying color filters like the utilities.) 080143AC = 020036E0 get_empty_slot() Return index. 080144C0 = 02003610 Disables entire list. (FFFF for all entries.) 08014504 = 0801451C = 02003610 Sort list 0801456C = 02003610 get_entry(function) 080145A8 = 02003610 add_entry(function, priority) If function is already listed, changes its priority. (Returns entry or number of entries?) 0801463C = Return 08014640 = Return 08014644 = 02003610 remove_entry(function) Sets priority to 7FFF. Returns entry. 08014694 = 02003610 ?(function) (5 Or 1) Return last matched entry. 080146D4 = 02003610 if function is 02****** and if (6&1)=0, then (5 Or 1). Return last matched entry. 0801471C = 02003610 set(function,+6) Return entry. 0801475C = 02003610 Return entry. 0801479C = 02003610 Ram functions set to even # priority (5) 080147D8 = 02003610 Execute_functions(priority) (5) 0801480C = 02003610 Count_functions(priority) (5) 08014840 = 02003610 Execute_functions(priority) (5, excludes value 4) 08014878 = rand() as Int16 //Returns a 16-bit random number. 0801489C = rotated coords(distance, angle, sp) sp has x, z, y. ; Calculates coords to a distance in a defined direction. Facing right is angle 0. Equivalent to: x += distance * cos(angle) y += distance * sin(angle) 080148E8 = getDirection(y>>3,x) (Might be used to face an object.) 080149B4 = 080149E0 = 080149F0 = get_sprite_palette_bank() 080149F8 = 03001250 String data: 0123456789ABCDEF (8 characters.) 08014A24 = 03001250 String data: Numeral integer (+/-) (11 chars.) 08014AA8 = Map Base fill F000 by size (arg0) 08014AE0 = Map base related… 08014B30 = (Minimum 8) 08014B50 = (Minimum 10) 08014B70 = Map Base BG0 fill all F000 (06002000-06002500) 08014BAC = Load font file, panel border palette, sprite palette, etc. 08014C4C = Load sprite palette 08014C6C = reset_space() 00-fills 03000000-? section, and sets free space to 03001300 & 02030000. 08014CA0 = get_free_size() Check 03 RAM. 08014CB0 = get_free_size() Check 02 RAM. 08014CC0 = get_free_space(rel_addr,size) Check 03 RAM first, then 02 RAM, if failed, return 0. 08014D00 = get_free_space(rel_addr,size) Check 02 RAM first, then 03 RAM, if failed, return 0. 08014D40 = fill_free_space(fill_val) 08014D78 = get_free_space(size) Check 03 RAM first, then 02 RAM, if failed, return 0. 08014DAC = get_free_space(size) Check 02 RAM first, then 03 RAM, if failed, return 0. Note: Free space limits are at 02030000-02040000 and 03001300-03006FC0. 08014DE0 = Return 08014DE4 08014E1C 08014E38 08014E74 08014E90 08014EA8 08014EE0 = 08014EFC = Angles related 08015024 = Angles related 08015068 = Angles related 080150AC = Angles related 080150E4 = Angles related 08015128 08015160 08015198 080151AC 080151E4 0801521C 0801524C = Angles related 08015384 = Angles related 08015510 080156E8 080156F8 08015714 08015768 08015778 08015830 = decompress(from,to) - Distance-Length - Data is in 16-bits. 0801587C = decompress(from_address, to_address) //I think? (& misc?) ; Format 0 and 1. 080158CC = decompress_image(from_address, to_address)? (Tileset image) ; Format 2. 0801591C = decompress(from,to) - Distance-Length ^Puts actual decompression routine into RAM, and calls it. 08016CA4 = locate_char_data(character_id) as Int32 //Returns pointer to character's data (Party Member or Enemy) 08016CE4 = read_flag(flag_number) as Boolean 08016CFC = write_flag(flag_number) 08016D18 = clear_flag(flag_number) 08016D34 = toggle_flag(flag_number) as Boolean //Returns 1 if toggled on, else 0 if toggled off. 08016D5C = read_byte(flag_number) as Byte 08016D6C = write_byte(flag_number, value) 08016D7C = increment_byte(flag_number) as Byte //Returns incremented byte. (Increments by 1.) 08016D98 = decrement_byte(flag_number) as Byte //Returns decremented byte. (Decrements by 1.) 08016DB4 = read_4bit(flag_number) as Int32 //Returns 4-bit value. 08016DD0 = write_4bit(flag_number) 08016DF8 = BIOS call swi $0B - (For copying data.) 08016DFC = swi $19 (0) 08016E04 = swi $19 (1) 08016E0C = 080178B4 = Pointers placed at 030001E4. 080178EC = 0x080179EA - Used in direction calculations (Sine, Cosine lookup table?) 0x08017AF0 - Panel Border Palette 0x08017B10 - Sprite Palette 08017CD0 = 0123456789ABCDEF